﻿using GameMath;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Models
{
    public class Fabric<T> where T : GameObject
    {
        private GameObject prototype;

        public Fabric(T prototype)
        {
            this.prototype = prototype;
        }

        public T Fabricate()
        {
            GameObject result = new PrototypeClass();
            result.Position = prototype.Position;
            result.Size = prototype.Size;
            return (T)result;
        }


        /// <summary>
        /// Private empty class for initialization of Fabricate result.
        /// </summary>
        private class PrototypeClass : GameObject
        {
            public PrototypeClass()
                : base(new GamePointF(-1, -1), new Size(-1, -1))
            {

            }

            public override void Update(GameTimer timer)
            {
                //do nothing
            }
        }
    
    }
}
